﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/AdministratorSite.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Home Page
</asp:Content>
<script runat="server">
    public void Page_Load()
    {
        GridViewSearchResult.DataSource = ViewData["searchResult"];
        GridViewSearchResult.DataBind();
        foreach (GridViewRow gvr in GridViewSearchResult.Rows)
        {
            ((HyperLink)gvr.Cells[0].Controls[0]).NavigateUrl = "~/AdminMain/ViewDetails?type=" + ViewData["resultType"] +
                                   "&key1="+ gvr.Cells[1].Text.ToString()+
                                   "&key2="+ gvr.Cells[2].Text.ToString()+
                                   "&key3="+ gvr.Cells[3].Text.ToString();
        }
        if (ViewData["searchCriteria"].ToString() != "")
        {
            dropdownlistSearchHotelCriteria.ClearSelection();
            ListItem tempItem = dropdownlistSearchHotelCriteria.Items.FindByValue(ViewData["searchCriteria"].ToString());
            if (tempItem != null) tempItem.Selected = true;

            dropdownlistSearchBookingCriteria.ClearSelection();
            tempItem = dropdownlistSearchBookingCriteria.Items.FindByValue(ViewData["searchCriteria"].ToString());
            if (tempItem != null) tempItem.Selected = true;

            dropdownlistSearchClientCriteria.ClearSelection();
            tempItem = dropdownlistSearchClientCriteria.Items.FindByValue(ViewData["searchCriteria"].ToString());
            if (tempItem != null) tempItem.Selected = true;
        }
        if (ViewData["resultType"] != "_transaction")
        {
            
        }
    }

    
</script>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>

  <script type="text/javascript">

      window.onload = loadPage;
      function loadPage() {
          if (ViewData["resultType"].toString() != "_transaction")
              disableSearchBooking();
      }
      $(function () {
          if (document.getElementById("datepickerStart").disabled == false) {
              $("#datepickerStart").datepicker({
                  dateFormat: 'dd-mm-yy'
          });
          //$("#datepickerStart").datepicker("option", "dateFormat", "dd-mm-yy");
              $("#datepickerEnd").datepicker({
                  dateFormat: 'dd-mm-yy'
              });
          //$("#datepickerEnd").datepicker("option", "dateFormat", "dd-mm-yy");
      }
  });
      function disableSearchBooking() {
          //document.getElementById("datepickerStart").disabled = true;
          //document.getElementById("datepickerEnd").disabled = true;
      }
      function searchBooking() {
          //document.getElementById("datepickerStart").disabled = false;
          //document.getElementById("datepickerEnd").disabled = false;
      }
  </script>

    <form id="form1" runat="server" style="width: 1155px">
        <asp:Panel ID="Panel2" runat="server" Height="61px" 
        style="font-size: xx-large; font-weight: 700; font-family: Calibri">
        <b>Search Results</b></asp:Panel>
        
        <table style="width: 95%; height: 276px;">
            <tr>
                <td style="width: 161px" valign="top">
                    &nbsp;</td>
                <td style="width: 46px">
                    &nbsp;</td>
                <td valign="top" colspan="2">
                <h2><%: ViewData["Message"] %></h2></td>
            </tr>
            <tr>
                <td style="width: 161px" valign="top">
                    &nbsp;</td>
                <td style="width: 46px">
                    &nbsp;</td>
                <td valign="top">



                    &nbsp;</td>
                <td valign="top" style="width: 244px">



                    &nbsp;</td>
            </tr>
            <tr>
                <td style="width: 161px" valign="top">
                    &nbsp;</td>
                <td style="width: 46px">
                    &nbsp;</td>
                <td valign="top">



                    &nbsp;</td>
                <td valign="top" style="width: 244px">



                    &nbsp;</td>
            </tr>
            <tr>
                <td style="width: 161px" valign="top">
        <table class="clear" border="" frame="border" 
            style="border-style: hidden; border-width: 0; border-spacing: 0px;">
            <tr>
                <td style="border-style: hidden; width: 83px" rowspan="3"></td>
                <td style="border-width: 0px; border-style: 0; width: 120px;">
                    <% if (ViewData["resultType"].ToString() == "_hotel")
                       {%>
                        <%= Html.RadioButton("radioButtonListMainSearch", "_hotel", true, new { @onclick = "disableSearchBooking()", @id="radioButtonListMainSearch" })%> Hotel
                        <% }
                       else
                       { %>
                    <%= Html.RadioButton("radioButtonListMainSearch", "_hotel", false, new { @onclick = "disableSearchBooking()", @id = "radioButtonListMainSearch" })%> Hotel
                    <% } %>
                </td>
                <td style="border-style: hidden">
                <asp:DropDownList id="dropdownlistSearchHotelCriteria" runat="server" 
                        Width="100px" >
                 <asp:ListItem Value="_name">Name</asp:ListItem>
                 <asp:ListItem Value="_address">Adress</asp:ListItem>
                 <asp:ListItem Value="_country">Country</asp:ListItem>
              </asp:DropDownList>
                
                                        

                </td>
                <td style="border-style: hidden">
                    &nbsp;</td>
            </tr>
            <tr>
                <td style="border-width: 0px; border-style: 0; width: 120px;">
                    <% if (ViewData["resultType"].ToString() == "_client")
                       {%>
                        <%= Html.RadioButton("radioButtonListMainSearch", "_client", true, new { @onclick = "disableSearchBooking()", @id = "radioButtonListMainSearch" })%> Client
                        <% }
                       else
                       { %>
                    <%= Html.RadioButton("radioButtonListMainSearch", "_client", false, new { @onclick = "disableSearchBooking()", @id = "radioButtonListMainSearch" })%> Client
                    <% } %>
                    
                </td>
                <td style="border-style: hidden">
                    <asp:DropDownList id="dropdownlistSearchClientCriteria" runat="server" 
                            Width="100px" >
                     <asp:ListItem Value = "_email">Email</asp:ListItem>
                     <asp:ListItem Value = "_name">Name</asp:ListItem>
                     <asp:ListItem Value = "_passportNo">Passport</asp:ListItem>
                     <asp:ListItem Value = "_country">Country</asp:ListItem>
                  </asp:DropDownList>
                    
                </td>
                </td>
                <td style="border-style: hidden">
                    &nbsp;</td>
            </tr>
            <tr>
                <td style="border-width: 0px; border-style: 0; width: 120px;">
                    <% if (ViewData["resultType"].ToString() == "_transaction")
                       {%>
                        <%= Html.RadioButton("radioButtonListMainSearch", "_transaction", true, new { @onclick = "searchBooking()", @id = "radioButtonListMainSearch" })%> Booking
                        <% }
                       else
                       { %>
                    <%= Html.RadioButton("radioButtonListMainSearch", "_transaction", false, new { @onclick = "searchBooking()", @id = "radioButtonListMainSearch" })%> Booking
                    <% } %>
                </td>
                <td style="border-style: hidden">
                    <asp:DropDownList id="dropdownlistSearchBookingCriteria" runat="server" 
                            Width="100px" >
                     <asp:ListItem Value = "_clientEmail">Client Email</asp:ListItem>
                     <asp:ListItem Value = "_hotelName">Hotel Name</asp:ListItem>
                  </asp:DropDownList>
                    
                </td>
                <td style="border-style: hidden">
                    &nbsp;</td>
            </tr>
            <tr>
                <td style="border-style: hidden; width: 83px"></td>
                <td style="border-width: 0px; border-style: 0; width: 120px;">     &nbsp;&nbsp;&nbsp;     From</td>
                <td style="border-style: hidden; width: 83px">
                <%: Html.TextBox("StartDate", ViewData["startDate"], new { style="width: 97px", @id = "datepickerStart"})%>

                    </td>
                <td style="border-style: hidden">
                    &nbsp;</td>
            </tr>
            <tr>
                <td style="border-style: hidden; width: 83px"></td>
                <td style="border-width: 0px; border-style: 0; width: 120px;">     &nbsp;&nbsp;&nbsp;     To</td>
                <td style="border-style: hidden; width: 83px">
                <%: Html.TextBox("EndDate", ViewData["endDate"], new { style="width: 97px", @id = "datepickerEnd"})%>

                    </td>
                <td style="border-style: hidden">
                    &nbsp;</td>
            </tr>
            <tr>
                <td style="border-style: hidden; width: 83px"></td>
                <td style="border-width: 0px; width: 120px;" colspan="2" 
                    align="center">
                     <%: Html.TextBox("searchString", ViewData["searchString"]) %></td>
                <td style="border-style: hidden">
                    &nbsp;</td>
            </tr>
            <tr>
                <td style="border-style: hidden; width: 83px">&nbsp;</td>
                <td style="border-width: 0px; border-style: 0; width: 120px;" colspan="2" 
                    align="center">
    <asp:Button ID="Button1" type="submit" name="submitButton" runat="server" Text="Search" 
                        style="text-align: left" TabIndex="6"/>
    
                </td>
                <td style="border-style: hidden">
                    &nbsp;</td>
            </tr>
            </table>
                </td>
                <td style="width: 46px">
                    &nbsp;</td>
                <td valign="top" colspan="2">



        <asp:GridView ID="GridViewSearchResult" runat="server" CellPadding="5" 
        ForeColor="#333333" GridLines="None" BorderStyle="Solid" 
        BorderWidth="1px" CellSpacing="7" ShowFooter="True" AllowSorting="True" 
                        style="margin-left: 59px">
            <AlternatingRowStyle BackColor="White" />
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
            <Columns>
                <asp:HyperLinkField Text="View Details" />
           </Columns>
            
        </asp:GridView>



                </td>
            </tr>
            <tr>
                <td style="width: 161px" valign="top">
                    &nbsp;</td>
                <td style="width: 46px">
                    &nbsp;</td>
                <td colspan="2">
                    &nbsp;</td>
            </tr>
        </table>

        <div>
    </div>
    </form>
</asp:Content>
